import os
import pandas as pd

# 创建一个空的DataFrame来存储所有CSV数据
combined_data = pd.DataFrame()

# 遍历目录下的所有文件
for filename in os.listdir(os.getcwd()):
    if filename.endswith('.csv') and filename.startswith('training') and ('3ap' in filename):
        print(filename)
        # 使用pandas读取CSV文件
        data = pd.read_csv(filename)
        # 将当前CSV文件的数据合并到总的DataFrame中
        combined_data = combined_data.append(data, ignore_index=True)

# 打印合并后的DataFrame
print(combined_data)
combined_data.to_csv('training_merge_3ap.csv')